package com.oa.order.dao;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Component;

import com.oa.order.entity.Order;

@Component
public interface OrderDao extends PagingAndSortingRepository<Order, Long>, JpaSpecificationExecutor<Order> {

	@Query("from Order o where o.userId = ?1")
	public Page<Order> findOne(Long userId, Pageable pageable);
	@Query("from Order o where o.userName = ?1")
	public Page<Order> findByOne(String userName, Pageable pageable);
	
	
}
